/**
  ******************************************************************************
  * @file           : day02_23.c
  * @author         : Cola
  * @date           : 2023/3/22 2:09
  ******************************************************************************
  */

#include <stdio.h>
#include <math.h>

int rob(int* nums, int numsSize){
    int prevMax = 0, currMax = 0;
    for (int i = 0; i < numsSize; i++) {
        int temp = currMax;
        currMax = fmax(prevMax + nums[i], currMax);
        prevMax = temp;
    }
    return currMax;
}

int main() {
    /*
     * 力扣 打家劫舍问题
     * */
    int nums[] = {1,2,3,1};
    int numsSize = 4;
    int result = rob(nums, numsSize);
    printf("%d", result);
    return 0;
}